package com.gzz.orchid.common.core.definition;

import com.gzz.orchid.common.core.support.IBaseEnum;

/**
 * 通用状态
 *
 * @author higmd
 */
public enum NormalStatus implements IBaseEnum {
    // 新增
    NEW(0, "新增")
    // 生效
    , ACTIVE(10, "生效")
    // 禁用
    , FORBIDEN(99, "禁用");
    private final int code;
    private final String text;

    NormalStatus(int code, String text) {
        this.code = code;
        this.text = text;
    }

    public static NormalStatus parse(int val) {
        for (NormalStatus e : NormalStatus.values()) {
            if (e.code == val) {
                return e;
            }
        }
        throw new IllegalArgumentException("Invalid NormalStatus Value: " + val);
    }

    public static NormalStatus of(String name) {
        return Enum.valueOf(NormalStatus.class, name);
    }

    @Override
    public Integer getValue() {
        return this.code;
    }

    @Override
    public String getLabel() {
        return this.text;
    }
}
